/*
 * history.h
 *
 *  Created on: 2022年2月4日
 *      Author: TamGitsun
 */

#ifndef HISTORY_H_
#define HISTORY_H_


#include "utils.h"
#include <tos_k.h>
#include <time.h>


#define HISTORY_SAVE_INTERVAL 60 * 30  // half an hour


typedef void (* FuncOnHistoryGetEachDay)(day_t day, int value);

typedef void (* FuncOnHistoryGetEachSecond)(k_tick_t t, int value);


void history_init(void);

void history_get_day(day_t begin, day_t end, FuncOnHistoryGetEachDay callback);  // [begin, end]

void history_get_second(k_tick_t begin, k_tick_t end, FuncOnHistoryGetEachSecond callback);  // [begin, end]

void history_put(k_tick_t time, int value);

day_t history_get_first_day(void);

void history_process(void);

void history_deinit(void);

void history_update_simulate_data(void);


#endif /* HISTORY_H_ */
